<template>
  <div>
    <h1>基础信息设计</h1>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="账号">
        <el-input v-model="form.Employees_Phone" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.Operator_Password" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.Employees_Name" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="form.Employees_Phone"></el-input>
      </el-form-item>
      <el-form-item label="公司名称">
        <el-input
          v-model="form.Operator_CompanyName"
          :disabled="true"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="GetFindById">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {},
      id: sessionStorage.getItem("id"),
    };
  },
  methods: {
    GetFindById() {
      this.$axios
        .get(
          "https://localhost:44360/api/app/t-mS_Operator/" +
            sessionStorage.getItem("id") +
            "/find-by-id"
        )
        .then((res) => {
          this.form = res.data.Data;
        });
    },
    submitForm() {
      this.$axios
        .put(
          "https://localhost:44360/api/app/t-mS_Operator/" +
            sessionStorage.getItem("id") +
            "/phone?name=" +
            this.form.Employees_Phone
        )
        .then((res) => {
          if (res.data > 0) {
            alert("修改成功");
            this.GetFindById();
          } else {
            alert("修改失败");
          }
        });
    },
  },
  created() {
    this.GetFindById();
  },
  computed: {},
};
</script>
<style scoped>
</style>